#ifndef _PLATFORM_I2C_H_
#define _PLATFORM_I2C_H_

#include "types.h"
#include "err.h"

#define I2C0           0x01C22000
#define I2C1	       0x01E28000

// I2c expander (I2c0) registers
#define I2CE_INPUT_PORT0   0x00
#define I2CE_INPUT_PORT1   0x01
#define I2CE_OUTPUT_PORT0  0x02
#define I2CE_OUTPUT_PORT1  0x03
#define I2CE_POLARITY_PORT0  0x04
#define I2CE_POLARITY_PORT1  0x05
#define I2CE_CONF_PORT0      0x06
#define I2CE_CONF_PORT1      0x07


err_t i2c_init(uint32_t port);
void i2c_write_reg(uint32_t port, uint8_t reg_addr, uint8_t value);
void i2c_write_reg2(uint32_t port, uint8_t reg_addr, uint8_t *value, uint8_t count);
void i2c_read_reg(uint32_t port, uint8_t reg_addr, uint8_t *value);

#endif
